home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib25 / clock.c < prev    next >
C/C++ Source or Header  |  1992-06-23  |  543b  |  24 lines

  1. /* clock -- return process time used so far, in units of CLK_TCK ticks
  2.    per second (under TOS, 200 per second) */
  3. /* written by ERS */
  4.  
  5. #include <time.h>
  6. #include <osbind.h>
  7.  
  8. extern clock_t _starttime; /* in main.c */
  9.  
  10. static clock_t now;
  11.  
  12. /* this must execute in supervisor mode; it fetches the system variable
  13.  * containing the number of 200HZ ticks since the system was booted
  14.  */
  15.  
  16. static void getnow() { now = *((unsigned long *) 0x4baL); }
  17.  
  18. clock_t
  19. clock()
  20. {
  21.     (void)Supexec(getnow);
  22.     return (now - _starttime);
  23. }
  24.